package com.maybach.web.framework.util;


import com.maybach.workflow.common.api.enums.RoleEnum;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by songshuang on 16/3/11.
 */
public class AuthenticationTool {

    private static final Logger log = LoggerFactory.getLogger(AuthenticationTool.class);

    public static Boolean hasAuthority() {
        Subject subject = SecurityUtils.getSubject();
        return subject.hasRole("adminFinance");
    }

    public static Boolean hasAdminFinace(){
        try {
            Subject subject = SecurityUtils.getSubject();
            return subject.hasRole(RoleEnum.adminFinance.name());
        } catch (Exception e) {
            log.error("error in hasAdminFinace");
            return false;
        }
    }


}
